Skip to content

Added support of partner API#20

Closed
yuri-kovalev wants to merge 6 commits into
green-api:masterfrom
yuri-kovalev:master
Closed

Added support of partner API#20
yuri-kovalev wants to merge 6 commits into
green-api:masterfrom
yuri-kovalev:master

Conversation

@yuri-kovalev
Copy link
Copy Markdown

Comment thread src/GreenApiClient.php
public $partner;

public function __construct( $idInstance, $apiTokenInstance, $host = "https://api.green-api.com", $media = "https://media.green-api.com" ) {
public function __construct( $idInstance = null, $apiTokenInstance = null, $partnerToken = null, $host = "https://api.green-api.com", $media = "https://media.green-api.com" ) {
Copy link
Copy Markdown
Author

@yuri-kovalev yuri-kovalev Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way php support named arguments from 8 version
new GreenApiClient(idInstance: 'idInstance', apiTokenInstance: 'apiTokenInstance', partnerToken: 'partnerToken')

Comment thread src/GreenApiClient.php
$this->statuses = new Statuses( $this );
$this->partnerToken = $partnerToken;

if ($this->idInstance && $this->apiTokenInstance) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this, but for partner API there is no need to use idInstance and apiTokenInstance because we may not have them.

@AshLeigh-Fraxinus
Copy link
Copy Markdown
Contributor

Added in v0.3.6

@yuri-kovalev
Copy link
Copy Markdown
Author

yuri-kovalev commented May 27, 2026

Added in v0.3.6

Seems you skip the partnerToken property

Used here

$this->partnerToken = $partnerToken;

In my PR it was added here https://github.com/green-api/whatsapp-api-client-php/pull/20/changes#diff-e88c5bbb6585d483f32ade677e436442ceab0eea5154278f75c706a4341336bbR30

@yuri-kovalev
Copy link
Copy Markdown
Author

yuri-kovalev commented May 27, 2026

And if we no have idInstance and apiTokenInstance (for example use only partner API) then we have an error.

$this->account = new Account( $this );

In my PR it was realized https://github.com/green-api/whatsapp-api-client-php/pull/20/changes#diff-e88c5bbb6585d483f32ade677e436442ceab0eea5154278f75c706a4341336bbR85

@yuri-kovalev
Copy link
Copy Markdown
Author

@AshLeigh-Fraxinus please look at my comments

@AshLeigh-Fraxinus
Copy link
Copy Markdown
Contributor

@yuri-kovalev thanks, added with the new commit, you can update the library

@yuri-kovalev
Copy link
Copy Markdown
Author

@AshLeigh-Fraxinus thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants